Java从入门到入土 |
您所在的位置:网站首页 › xml 注释 › Java从入门到入土 |
当我们写的代码量较多的时候,注释可帮助我们快速理解我们所写代码的意思。在Java中,注释分为三种:单行注释、多行注释和文件注释。接下来我们就分别了解这三种注释的形式和应用方法。 一、单行注释-----// 每一行前加“//”即表示该行被注释: public static void main(String[] args){ System.out.println("helloworld"); //输出helloworld语句 }注释量少的时候适用。 二、多行注释----/**/ public static void main(String[] args){ System.out.println("helloworld"); /* 输出helloworld语句 输出helloworld语句 输出helloworld语句 输出helloworld语句 */ }三、文件注释 /** *.... */ public static void main(String[] args){ System.out.println("helloworld"); /** *输出helloworld语句 *@author:陈小将 */ }文件注释可给代码添加标签,后续更新将会补充文件注释的相关内容。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |